package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/*
        *类名：AlipayConfig
        *功能：基础配置类
        *详细：设置帐户有关信息及返回路径
        *修改日期：2017-04-05
        *说明：
        *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
        *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
*/


public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117644463";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpzZ/rBO6VfuVH7n6V5I768GK8Ay7c13H0yFnLnthPoqU5LV5LOw5z//mDJIvXO1cLc1EJKGUdMNTlaO7kDSV40ppvS/yYocyydwi8zaWOIvf5s4JCDGKy6QKpRnUTsaQvAhV+4eQaWU/Upe9J9ANZ2+Mpu++tQCKTS864jOlSF9HBwF567RmaFyq4FxeTUimvjXsKr8dJNlu5tSBpvYpPmPR25MvKaLasxVJ8FIttolobMdCKuP48m14DNtz+kTf2704r3vtSQzpWJRGoRgaZDI04cd443kzKfcvcQICL3BhKWX7/UPx9v3bTtwxfN80Npa1+9kmY420rygGMDT8rAgMBAAECggEAAhFM5zGyLgPTiuKui+iyjP+sVBm90laVPqPJ5B7VB3M1i9KvmT7o2CS/xwcE5OQGFU+cJv5k7MwRa5GxhvlaAXSfCMfmFX2y3mFwq8vdPjPSzSmQZnl8Ii2QKLuA5XJ+S0w9MsRRYLjBrhcvKLld6RQyWem962Aii6SaqciddrBqc0GpCzDHmoap0oX+/QUdi59ABzgQq9H7WBHrD69rJK0UDfyuXnNX9rMGhuI/U236fdjn3ri/5TujaW8txu7sB2BA0C8sdfRfg5epa73tZXnqqtpZ6AYrwBAc9DHoIpolLfpwmf/xUCIHwypMAzIeRLjIp7/GY4eCiWbDETX3MQKBgQDpgVcR4Hb37CwtarJxr8e0G4F6qa1NQN4RA3+gugOpzhHMB3EO8Whz9h1M6hZuRs4x3q+LxqmjjTJ9J9N3S0KJhNQIqxHmgqnod1bFGCSKSlaLEoghnk+h5kzJXyz7PKby308FDh8D0sNR03JGpWP4mKm2oXNZaaYXi3FoYLxIRwKBgQC6KUcyqo7mO6Bznksj9Xj0YRre3XNvKX+yoo5Rnj+02LcLOK4Ca2ECihF+OI+w0wB0AGQ0NCRURlYQohiVJKWhhJ9hl+cuHPcqGhkKq0mKnTT/+fUKwk/c3Ik5kVTbwz97Wns2bsZm/+Mn01ZcBiLrSQSBR+E1s3FIgH2pN9En/QKBgQC+SzLLFdO+bhD+nkJ4Vdl5FSVq8paSK7gNw30iXhWYL6DfVn0zwVbvkfYE9Yx8KGXnzGPhlHAxImOwDWHPiVzbN42Y1tlKsteG5KKpEujMbpKi2eJpC1w4Q7f2MAM3aBFiQsxiAUUTV5Lnv1sU6bpUIQ3GEUMw7eF2tKQifRtUBwKBgEm1oGA6UhxtDYnZ6kyRnFO+wyHtMxCXsN0tKga9DuJvUIKb7aI9nAqiWmzMvnA4C5zirspQvvWzZ85sMCmVehNq7KR6velvRJoh/TpROewtdNfJw7F/4JlFpPvrRFtDgrY3zENwNxR/SxTww+fp8heRMLxzloNpynf3kEnZNPKNAoGAW5tmsi3b07dQ9rTLziespYQTBFfehroW8/t8oGkpvofbRwfT5xrn4aVvCHCmb1EYq5z2uNh+dAQgDtBYotC55Ron4enA24bwXf0w9932H50k2PfEuV5DvHuWW77++1/II2sEiRViEucfOdCk4aIGLQTmYMFj0fAHBS1HWeaE1JA=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmeSkV5rKiu7+YfNK2yHYTSmmxylaFA5GBuLR1F/vvunz9/54Q6msVb2ytczgP3P2jyyspgl0qh7+8QfeFyxTo+2FTDcPeJxXcapNf4/QJPZeemxBvStjAWrVIyhnhuyMU/JOfmINF1TPNjnh3xFlcO0LNfqAIJPhTHf2D5hz8COe+SeSeIsxj4nEVqGTEh4knQ0a9rm1QxyCixCBCF79W4dqxihtq39iMEeGxECn9Vjs+iXIAoYajqUFjMlQAheLzRleAiWu315LA6FdzoV3W6h9TqiEyU8jfiIVfl0w9PqtzoV9Nw1tzKd6s6+fylVHqdxK1fYAe9GoYHbYgXShmQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/BuyingTickets/login/Login";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/BuyingTickets/login/Login";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
